<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateStorePinksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('store_pinks', function (Blueprint $table) {
            $table->id()->comment('拼团表');
            $table->integer('user_id')->comment('用户ID')->index();
            $table->integer('product_id')->comment('商品id')->index();
            $table->integer('order_id')->comment('订单id 生成')->index();
            $table->integer('order_id_key')->comment('订单id  明细')->index();
            $table->integer('combination_goods_id')->comment('拼团商品id')->index();
            $table->integer('head_id')->default(0)->comment('团长id 0为团长');
            $table->integer('people')->comment('拼团总人数');
            $table->integer('total_num')->comment('购买商品个数');
            $table->decimal('total_price',10,2)->comment('购买总金额');
            $table->decimal('price',10,2)->comment('拼团商品单价');
            $table->timestamp('start_time')->comment('开始时间');
            $table->timestamp('stop_time')->comment('结束时间');
            $table->tinyInteger('is_tpl')->default(0)->comment('是否发送模板消息0未发送1已发送');
            $table->tinyInteger('is_refund')->default(0)->comment('是否退款 0未退款 1已退款');
            $table->string('status',30)->default('noCompleted')->comment('状态 haveInHand：进行中completed:已完成 noCompleted:未完成');
            $table->tinyInteger('is_virtual')->default(0)->comment('是否虚拟拼团');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('store_pinks');
    }
}
